#pragma once
#include <ui/multi_lang.h>
#include <interface/xml_parser_interface.h>
#include <interface/interface.h>
#include <Util/WinAPITools.h>
#include "dll_object.h"
#include "resource.h"
#include "res_string_def.h"

class multi_lang_impl : public multi_lang
{
public:
	multi_lang_impl(){}
	~multi_lang_impl(){}

	bool init()
	{
		if ( !dll_object::im_->query_interface(this->res_str_parser_, "ires_parser") )
		{
			return FALSE;
		}
	
		std::string xml_fn = aot::tt::utility::get_module_path(theApp.m_hInstance) +
			"language\\2052\\res_string.xml";

		if ( !this->res_str_parser_.open(xml_fn.c_str()) )
		{
			return FALSE;
		}

		insert_res_string("IDS_SMS_PAGE_MAIN_CAPTION_TATA",IDS_SMS_PAGE_MAIN_CAPTION_TATA);
		insert_res_string("IDS_SMS_GET_ADD_RECIPIENTS_PROMPT",IDS_SMS_GET_ADD_RECIPIENTS_PROMPT);
		insert_res_string("IDS_SMS_ENTERPRISE_ADD_RECIPIENTS_PROMPT",IDS_SMS_ENTERPRISE_ADD_RECIPIENTS_PROMPT);
		insert_res_string("IDS_SMS_INDIVIDUAL_ADD_RECIPIENTS_PROMPT",IDS_SMS_INDIVIDUAL_ADD_RECIPIENTS_PROMPT);
		
		insert_res_string("IDS_SMS_SHOWMSG_PROMPT1",IDS_SMS_SHOWMSG_PROMPT1);
		insert_res_string("IDS_SMS_SHOWMSG_PROMPT2",IDS_SMS_SHOWMSG_PROMPT2);

		insert_res_string("IDS_SMS_SHOWMSG_IDIOGRAPH",IDS_SMS_SHOWMSG_IDIOGRAPH);
		insert_res_string("IDS_SMS_SHOWMSG_IDIOGRAPH_DFPROMPT",IDS_SMS_SHOWMSG_IDIOGRAPH_DFPROMPT);

		insert_res_string("IDS_SMS_UNDO",IDS_SMS_UNDO);
		insert_res_string("IDS_SMS_COPY",IDS_SMS_COPY);
		insert_res_string("IDS_SMS_COPY",IDS_SMS_COPY);
		insert_res_string("IDS_SMS_PASTE",IDS_SMS_PASTE);
		insert_res_string("IDS_SMS_DELETE",IDS_SMS_DELETE);
		insert_res_string("IDS_SMS_SELECT_ALL",IDS_SMS_SELECT_ALL);

		insert_res_string("IDS_BTNS_SEL_PLATFORM",IDS_BTNS_SEL_PLATFORM);
		insert_res_string("IDS_BTNS_SEND_NOTE",IDS_BTNS_SEND_NOTE);
		insert_res_string("IDS_BTNS_SAVE_NOTE",IDS_BTNS_SAVE_NOTE);
		insert_res_string("IDS_BTNS_CALEAR_NOTE",IDS_BTNS_CALEAR_NOTE);
		insert_res_string("IDS_BTNS_ADD_LINKMAN",IDS_BTNS_ADD_LINKMAN);
		insert_res_string("IDS_BTNS_RECHARGE",IDS_BTNS_RECHARGE);
		insert_res_string("IDS_BTNS_HISTORY_SMS",IDS_BTNS_HISTORY_SMS);

		insert_res_string("IDS_SMS_NO_NAME",IDS_SMS_NO_NAME);
		insert_res_string("IDS_SMS_NO_MONEY_1",IDS_SMS_NO_MONEY_1);

		insert_res_string("IDS_SMS_CONTENT_IS_NULL_ERROR",IDS_SMS_CONTENT_IS_NULL_ERROR);
		insert_res_string("IDS_SMS_PLEASE_INPUT_NUMBER",IDS_SMS_PLEASE_INPUT_NUMBER);
		insert_res_string("IDS_SMS_PLEASE_INPUT_CONTENT",IDS_SMS_PLEASE_INPUT_CONTENT);

		insert_res_string("IDS_SMS_PHONE_FORMAT_LEN_ERROR",IDS_SMS_PHONE_FORMAT_LEN_ERROR);
		insert_res_string("IDS_SMS_PHONE_FORMAT_NONLICET_NUM",IDS_SMS_PHONE_FORMAT_NONLICET_NUM);

		insert_res_string("IDS_SMS_NO_BINDING_MOBILE",IDS_SMS_NO_BINDING_MOBILE);

		insert_res_string("IDS_SMS_NO_MONEY",IDS_SMS_NO_MONEY);

		insert_res_string("IDS_SMS_CANCEL",IDS_SMS_CANCEL);
		insert_res_string("IDS_SMS_REPORT",IDS_SMS_REPORT);

		insert_res_string("IDS_SMS_EXCEED_SEND_NOTE_LENGTH",IDS_SMS_EXCEED_SEND_NOTE_LENGTH);
		insert_res_string("IDS_SMS_EXCEED_SEND_NOTE_LINKMAN_COUNT",IDS_SMS_EXCEED_SEND_NOTE_LINKMAN_COUNT);

		insert_res_string("IDS_SMS_REFURBISH_MONEY",IDS_SMS_REFURBISH_MONEY);

		insert_res_string("IDS_SMS_QUERY_MONEY_FAILD",IDS_SMS_QUERY_MONEY_FAILD);
		return TRUE;
	}

private:
	bool insert_res_string(const char* id, int string_def)
	{
		std::string val = this->res_str_parser_.get_string(id, "");
		return insert_res_string_i(val.c_str(), string_def);
	}

	aot::tt::res_parser_string_helper res_str_parser_;

};

